# -*- coding: utf-8 -*-

from django.contrib import admin
from hkg.company.models import Company, Officer, HKSFCCompany, HKSFC_SPO_RO, HKSFC_SPO_RR, HKSFCCompanyAddress,Foreign_Cos_in_China,China_High_School

class CompanyAdmin(admin.ModelAdmin):
    list_display = ['stock_code', 'name', 'mkt_cap', 'address', 'tel', 'fax', 'employees']
    search_fields = ['name', 'stock_code']


class OfficerAdmin(admin.ModelAdmin):
    list_display = ['first_name', 'last_name', 'title', 'level', 'company']
    list_filter = ['level']
    search_fields = ['first_name', 'last_name', 'title', 'company__name']


class AddressInline(admin.TabularInline):
    model = HKSFCCompanyAddress
    
class HKSFCCompanyAdmin(admin.ModelAdmin):
    
    
    list_display = ['name', 'address', 'tel', 'fax', 'homepage', 'email_suffix']
    search_fields = ['name']
    inlines = [AddressInline]
    
#class HKSFCOfficerAdmin(admin.ModelAdmin):
    #list_display = ['name_en', 'name_ch', 'company', 'reg_no', 'classifying']
    #list_filter = ['company']
    #search_fields = ['name_en', 'name_ch', 'reg_no','company__name']

class HKSFC_SPO_ROAdmin(admin.ModelAdmin):
    list_display = ['name_en', 'name_ch', 'company', 'reg_no']
    search_fields = ['name_en', 'name_ch', 'reg_no','company__name']
    
class HKSFC_SPO_RRAdmin(admin.ModelAdmin):
    list_display = ['name_en', 'name_ch', 'company', 'reg_no']
    search_fields = ['name_en', 'name_ch', 'reg_no','company__name']

class Foreign_Cos_in_ChinaAdmin(admin.ModelAdmin):
    list_display = ['company_name', 'address', 'china_investor1', 'foreign_investor1', 'chairman', 'president','mail_code','phone','fax']
    search_fields = ['company_name', 'address', 'chairman','president']
    
class China_High_SchoolAdmin(admin.ModelAdmin):
    list_display = ['school_name', 'mail_code', 'address', 'phone','principal','junior_high_school_students','high_school_students']
    search_fields = ['school_name', 'address', 'principal']

admin.site.register(Company, CompanyAdmin)
admin.site.register(Officer, OfficerAdmin)
admin.site.register(HKSFCCompany, HKSFCCompanyAdmin)
admin.site.register(HKSFC_SPO_RO, HKSFC_SPO_ROAdmin)
admin.site.register(HKSFC_SPO_RR, HKSFC_SPO_RRAdmin)
admin.site.register(Foreign_Cos_in_China, Foreign_Cos_in_ChinaAdmin)
admin.site.register(China_High_School, China_High_SchoolAdmin)
